package demo.annotation;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.*;

/**
 * @author GuoFei
 * @date 2018/9/5 16:36
 */
@Component
public class TestAnnotation {

//    @MyAnnotation(world = "Hello,world",canContinue = true)
//    public void output() {
//        if (AnnotationHelper.canContinue()) {
//            System.out.println("can!!!");
//        } else {
//            System.out.println("fail~~~");
//        }
//    }

    public static void main(String[] args) {
        UserInfo userInfo = new UserInfo();
        userInfo.setAge(1);
        userInfo.setId(5);
        Set<Integer> nu = new HashSet<>();
        userInfo.setNumber(nu);
        userInfo.getNumber().add(1);
        userInfo.getNumber().add(2);
        userInfo.getNumber().add(5);
        userInfo.getNumber().add(4);
        List<Integer> temp = new ArrayList<>(userInfo.getNumber());
        Collections.reverse(temp);
        Set<Integer> newNu = new TreeSet<>(temp);
        userInfo.setNumber(newNu);
        System.out.println(JSON.toJSONString(userInfo));
    }

    @Data
    public static class UserInfo{
        int id;
        int age;
        Set<Integer> number;
    }

}
